package web.suzy.oj.dao.user.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import web.suzy.oj.dao.user.UserRecordEntityService;
import web.suzy.oj.mapper.JudgeMapper;
import web.suzy.oj.mapper.UserRecordMapper;
import web.suzy.oj.pojo.entity.judge.Judge;
import web.suzy.oj.pojo.entity.user.UserRecord;
import web.suzy.oj.pojo.vo.ACMRankVO;
import web.suzy.oj.pojo.vo.OIRankVO;
import web.suzy.oj.pojo.vo.UserHomeVO;

import java.util.List;

/**
 * YangSuzy 软件工作室
 * 类名: UserRecordEntityServiceImpl
 * 描述: ---- 待定 -----
 * 功能: ---- 待定 -----
 *
 * @author YangSuzy
 * Date: 2022/11/23 13:56
 */
@Service
public class UserRecordEntityServiceImpl extends ServiceImpl<UserRecordMapper, UserRecord> implements UserRecordEntityService {

    @Autowired
    private UserRecordMapper userRecordMapper;

    @Autowired
    private JudgeMapper judgeMapper;

    /**
     * 方法名: getACMRankList
     * 描述: 获取ACM排行榜数据
     *
     * @param page    分页对象
     * @param uidList 用户ID列表
     * @return com.baomidou.mybatisplus.core.metadata.IPage<web.suzy.oj.pojo.vo.ACMRankVO>
     * @date 2022/11/23 13:58
     * @auther YangSuzy
     **/
    @Override
    public IPage<ACMRankVO> getACMRankList(Page<ACMRankVO> page, List<String> uidList) {
        return userRecordMapper.getACMRankList(page, uidList);
    }

    /**
     * 方法名: getRecent7ACRank
     * 描述: 获取最近 7 天通过数排行前 10 名的数据
     *
     * @return java.util.List<web.suzy.oj.pojo.vo.ACMRankVO>
     * @date 2022/11/23 13:59
     * @auther YangSuzy
     **/
    @Override
    public List<ACMRankVO> getRecent7ACRank() {
        return userRecordMapper.getRecent7ACRank();
    }

    /**
     * 方法名: getOIRankList
     * 描述: 获取OI排行榜数据
     *
     * @param page    分页对象
     * @param uidList 用户ID列表
     * @return com.baomidou.mybatisplus.core.metadata.IPage<web.suzy.oj.pojo.vo.OIRankVO>
     * @date 2022/11/23 14:00
     * @auther YangSuzy
     **/
    @Override
    public IPage<OIRankVO> getOIRankList(Page<OIRankVO> page, List<String> uidList) {
        return userRecordMapper.getOIRankList(page, uidList);
    }

    /**
     * 方法名: getUserHomeInfo
     * 描述: 获取用户主页信息
     *
     * @param uid      用户ID
     * @param username 用户名
     * @return web.suzy.oj.pojo.vo.UserHomeVO
     * @date 2022/11/23 14:01
     * @auther YangSuzy
     **/
    @Override
    public UserHomeVO getUserHomeInfo(String uid, String username) {
        return userRecordMapper.getUserHomeInfo(uid, username);
    }

    /**
     * 方法名: getLastYearUserJudgeList
     * 描述: 获取最近一年用户的提交测评列表
     *
     * @param uid      用户ID
     * @param username 用户名
     * @return java.util.List<web.suzy.oj.pojo.entity.judge.Judge>
     * @date 2022/11/23 14:17
     * @auther YangSuzy
     **/
    @Override
    public List<Judge> getLastYearUserJudgeList(String uid, String username) {
        return judgeMapper.getLastYearUserJudgeList(uid, username);
    }
}
